package com.powermgr.boringtest.controller;

import com.powermgr.boringtest.result.Result;
import com.powermgr.boringtest.service.IVisitService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * VisitController
 *
 * @author qiuxiangdong
 * @date 2023/6/12
 */
@Controller
public class
VisitController {
    @Resource
    private IVisitService visitService;
    @GetMapping()
    public String incrementVisit(){
        visitService.incrementVisit();
        return "index";
    }
    @CrossOrigin
    @ResponseBody
    @GetMapping(value = "/count")
    public Result<Object> getCurrentStatistics(){
        return visitService.getCurrentStatistics();
    }

}